package com.minis.context;

import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述
 *
 * @author wanghongqian
 * @date 2023/10/18 21:07
 */
public class SimpleApplicationEventPublisher implements ApplicationEventPublisher{

    List<ApplicationListener> listeners = new ArrayList<>();

    @Override
    public void publishEvent(ApplicationEvent event) {
        for(ApplicationListener listener:listeners){
            listener.onApplicationEvent(event);
        }
    }

    @Override
    public void addApplicationListener(ApplicationListener listener) {
        this.listeners.add(listener);
    }
}
